package com.iussoft.receiveData.schedul;

import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.support.CronTrigger;

import java.util.Date;

/**
 * 自定义 业务触发器
 */
public class CustomTrigger implements Trigger {

    private String cron;

    private CustomTrigger(){
        //
    }
    public CustomTrigger(String cron){
        this.cron = cron;
    }

    @Override
    public Date nextExecutionTime(TriggerContext triggerContext) {
        CronTrigger trigger = new CronTrigger(cron);
        return trigger.nextExecutionTime(triggerContext);
    }
}
